<template>
  <div class="preview-container">
    <div class="start-btn">
      <!-- <el-button  @click="startExam">开始考试</el-button> -->
      <el-button @click="showRole">开始考试</el-button>
    </div>

    <!-- <div class="ppt-img">
      <img :src="imageArr[0]" alt="">
    </div> -->

    <!-- <div class="role-exam">
       <div class="btn">
        <el-button  @click="()=>this.$router.push({name:'QuickScene'})" style="float: right;" icon="el-icon-arrow-right">
        </el-button>
       </div>
    </div> -->

    <div class="role-exam">
      <img :src="imageArr[imgIndex]" alt="" />

      <div class="btn">
        <el-button @click="backExam" icon="el-icon-arrow-left"> </el-button>
        <el-button
          @click="startExam"
          icon="el-icon-arrow-right"
          style="float: right"
        >
        </el-button>
      </div>
    </div>
  </div>
</template>

<script>
import { getToken } from "@/utils/auth";
export default {
  name: "PreviewRequired",

  data() {
    return {
      roleExam: false,
      loginForm: {
        username: "",
        password: "",
      },
      imgIndex: 0,
      imageArr: [
        "images/bg/2.jpg",
        "images/bg/3.jpg",
        "images/bg/4.jpg",
        "images/bg/5.jpg",
        "images/bg/6.jpg",
        "images/bg/7.jpg",
        "images/bg/8.jpg",
        "images/bg/9.jpg",
        "images/bg/10.jpg",
        "images/bg/11.jpg",
        "images/bg/12.jpg",
        "images/bg/13.jpg",
        "images/bg/14.jpg",
        "images/bg/15.jpg",
        "images/bg/16.jpg",
        "images/bg/17.jpg",
        "images/bg/18.jpg",
        "images/bg/19.jpg",
        "images/bg/20.jpg",
        "images/bg/21.jpg",

      ],
    };
  },
  methods: {
    
    showRole() {
      this.roleExam = true;
    },
    startExam() {
      // console.log(this.imgIndex);
      this.imgIndex++
      if (this.imgIndex >= this.imageArr.length) {
        this.$router.push({ name: "QuickScene" });
      }
    },
    backExam() {
      if (this.imgIndex > 0) {
        this.imgIndex--;
      } else {
        this.$router.go(-1);
      }
      // this.roleExam = false;
    },
  },
};
</script>

<style scoped>
.preview-container {
  min-height: 100vh;
  /* background: linear-gradient(135deg, #f5f7fa 0%, #e4e7ed 100%); */
  /* background-image: url("/images/bg/1_1217.jpg"); */
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  /* padding: 20px; */
}

.ppt-img {
  width: auto;
  height: 100vh;
  object-fit: fill;
  margin: 0 auto;
  display: block;
}

.start-btn {
  position: relative;
}

.start-btn .el-button {
  width: 480px;
  height: 180px;
  position: absolute;
  bottom: -255px;
  left: -240px;
  /* border-radius: 10%; */
  opacity: 0;
}

.role-exam {
  width: 100%;
  height: 100%;
  display: flex;
}

.role-exam img {
  width: 100%;
  height: 100%;
}

.btn{
  width: 99%;
  bottom: 20px;
  position: fixed;
  opacity: 0.3;
  margin: 0 10px;
}
</style>